package com.michael.study.listview

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.michael.study.listview.databinding.ActivityLinearMainBinding

class LinearMainActivity : AppCompatActivity() {


    private lateinit var mBinding: ActivityLinearMainBinding
    private var mData = ArrayList<String>();
    private lateinit var mAdapter: LinearAdapter;

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBinding = ActivityLinearMainBinding.inflate(layoutInflater)
        setContentView(mBinding.root)
        for (i in 0 until 20) {
            mData.add("" + i)
        }

        mAdapter = LinearAdapter(this, mData);

        mBinding.recyclerView.layoutManager = CustomLayoutManager()
        //mBinding.recyclerView.addItemDecoration(DrawableItemDecoration(this));
        //mBinding.recyclerView.addItemDecoration(HeaderItemDecoration(this));

        mBinding.recyclerView.adapter = mAdapter
    }
}